package com.id.supaclean.ui

import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.lifecycle.lifecycleScope
import com.id.supaclean.R
import com.id.supaclean.common.BaseFragment
import kotlinx.coroutines.delay

class SplashFragment : BaseFragment() {


    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_splash, container, false)
    }


    override fun layoutId(): Int = R.layout.fragment_splash

    override fun initEvent() {
        super.initEvent()
        lifecycleScope.launchWhenResumed {
            delay(2000)
            val intent = Intent(this@SplashFragment.requireActivity(), MainActivity::class.java)
            startActivity(intent)
        }
    }

}